package ${classPath}.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import ${commonPackage}.dao.BaseDao;
import ${classPath}.entity.${table.className}${entitySuffix};
import ${classPath}.param.${table.className}Param;

/**
 * ${table.remark}Dao实现类
 *
 * @author ${author}
 * @version ${currentDate} ${author}
 */
 @Repository("${table.getPropertyName()}Dao")
public class ${table.className}DaoImpl extends BaseDao<${table.className}${entitySuffix}>{
    
    /**
     * 新增，注：返回的添加的条数，获取主键用entity.getId();
     *
     * @param entity 要增加的${table.remark}对象
     * @return 返回新增的条数
     */
    public Integer insert(${table.className}${entitySuffix} entity){
    	return sqlMapClientTemplate.insert("insert${table.className}", entity);
    }

	/**
     * 修改
     *
     * @param entity 要修改的${table.remark}对象
     * @return 返回修改的条数
     */
    public Integer update(${table.className}${entitySuffix} entity){
    	return sqlMapClientTemplate.update("update${table.className}ById", entity);
    }

	/**
     * 根据ID获取${table.remark}实体
     *
     * @param id 主键
     * @return ${table.remark}信息
     */
    public ${table.className}${entitySuffix} findById(String id){
    	return sqlMapClientTemplate.queryForObject("select${table.className}ById", id);
    }
	
	/**
     * 按查询条件【分页】查询
     *
     * @param param ${table.remark}查询条件
     * @return ${table.remark}列表
     */
    public List<${table.className}${entitySuffix}> queryByPage(${table.className}Param param){
    	return queryList("select${table.className}List",param);
    }

	/**
     * 根据ID删除${table.remark}
     *
     * @param id 主键
     */
    public Integer delete(String id){
       return sqlMapClientTemplate.delete("delete${table.className}ById", id);
    }
}